package com.emergency.embackend.service.impl;

import com.emergency.embackend.common.PageParams;
import com.emergency.embackend.entity.ContentReturn;
import com.emergency.embackend.mapper.ContentReturnMapper;
import com.emergency.embackend.service.ContentReturnService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ContentReturnServiceImpl implements ContentReturnService {
    @Autowired
    private ContentReturnMapper contentReturnMapper;
    //添加
    @Override
    public void addContentReturn(ContentReturn contentReturn){
        contentReturnMapper.insertContentReturn(contentReturn);
    }
    //删除
    @Override
    public void delete(Long contentId) {
        contentReturnMapper.delete(contentId);
    }
    //查询
    @Override
    public PageInfo page(PageParams pageParams) {
        PageHelper.startPage(pageParams.getPageNum(), pageParams.getPageSize());
        List<ContentReturn> resList = contentReturnMapper.page(pageParams);
        PageInfo pageInfo = new PageInfo(resList);
        return pageInfo;

    }

}
